#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''=================================================
@Project -> File   ：GetCSProduct_New -> product
@IDE    ：PyCharm
@Author ：Json
@Date   ：2021-03-31 10:58
@Desc   ：
=================================================='''
import json

from cs_api.base import Client


class Orders(Client):
    URI = "/"

    def __init__(self, cs_user):
        super().__init__(cs_user)

    def cancel_order(self, location, cs_order_id):
        """
        input:
        {
          "dropShipId": "3634387",
          "lang": "en_us",
          "region": "US"
        }
        :param location:
        :param cs_order_id:
        :return:
        {
          "code": 200,
          "msg": "Cancel dropShip order success.",
          "result": null
        }
        """
        data = {
            "dropShipId": cs_order_id,
            "lang": "en_us",
            "region": location
        }

        return self.make_request("PUT", "drop-ship/cancel", data)

    def search_order_info(self, location, search_info):
        """

        :param location: HK,US
        :return:
        """
        data = {"search": search_info,
                "startDate": '',
                "customerNo": [],
                "endDate": '',
                "dropShipId": "",
                "shipBy": [],
                "country": [],
                "rows": 20,
                "lang": "en_us",
                "region": location}

        return self.make_request("POST", "drop-ship/filter/list", data)
